from pydantic import BaseModel, Field
from typing import Optional


class MenuCreate(BaseModel):
    name: str = Field(..., description="权限名称")
    code: str = Field(..., description="权限代码")
    desc: Optional[str] = Field(None, description="权限描述")
    parent_id: Optional[int] = Field(None, description="父级权限ID")
    type: int = Field(1, description="类型：1菜单，2按钮")
    path: Optional[str] = Field(None, description="路由路径")
    component: Optional[str] = Field(None, description="组件路径")
    icon: Optional[str] = Field(None, description="图标")
    sort: Optional[int] = Field(0, description="排序")
    status: Optional[bool] = Field(True, description="状态")
    is_hidden: Optional[bool] = Field(False, description="是否隐藏")
    keep_alive: Optional[bool] = Field(True, description="是否缓存")
    is_iframe: Optional[bool] = Field(False, description="是否内嵌")
    link: Optional[str] = Field(None, description="外部链接")


class MenuUpdate(BaseModel):
    name: Optional[str] = Field(None, description="权限名称")
    code: Optional[str] = Field(None, description="权限代码")
    desc: Optional[str] = Field(None, description="权限描述")
    parent_id: Optional[int] = Field(None, description="父级权限ID")
    type: Optional[int] = Field(None, description="类型：1菜单，2按钮")
    path: Optional[str] = Field(None, description="路由路径")
    component: Optional[str] = Field(None, description="组件路径")
    icon: Optional[str] = Field(None, description="图标")
    sort: Optional[int] = Field(None, description="排序")
    status: Optional[bool] = Field(None, description="状态")
    is_hidden: Optional[bool] = Field(None, description="是否隐藏")
    keep_alive: Optional[bool] = Field(None, description="是否缓存")
    is_iframe: Optional[bool] = Field(None, description="是否内嵌")
    link: Optional[str] = Field(None, description="外部链接")